﻿using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using WebApplication1.Models;

namespace WebApplication1.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        public IActionResult Index()
        {
            //return View();

            var model = new List<article>
            {
                new article { ID = 1,
                img = "images/mlc.png",
                    title = "木兰辞", content = "人生若只如初见，何事秋风悲画扇。\r\n等闲变却故人心，却道故人心易变。\r\n骊山语罢清宵半，泪雨霖铃终不怨。\r\n何如薄幸锦衣郎，比翼连枝当日愿。" },

                new article { ID = 2,
                     img = "images/qthcx.png",
                    title = "钱塘湖春行", content = "孤山寺北贾亭西⑵，水面初平云脚低⑶。\r\n几处早莺争暖树⑷，谁家新燕啄春泥⑸。\r\n乱花渐欲迷人眼⑹，浅草才能没马蹄⑺。\r\n最爱湖东行不足⑻，绿杨阴里白沙堤" },
                //new article { id = 3, title = "title3", body = "body3" },
                //new article { id = 4, title = "title4", body = "body4" },
                //new article { id = 5, title = "title5", body = "body5" }
            };

            return View(model);
        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}
